package com.example.adminvue.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.adminvue.domain.BKind;
import com.example.adminvue.mapper.BKindMapper;
import com.example.adminvue.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
*
*/
@Service
public class BKindService
{
    @Autowired
    private BKindMapper bKindMapper;


    public List<BKind> selectList(BKind kind) {
        LambdaQueryWrapper<BKind> queryWrapper = new LambdaQueryWrapper<>();
        if(StringUtils.isNotEmpty(kind.getKindName())){
            queryWrapper.eq(BKind::getKindName,kind.getKindName());
        }

        List<BKind> list = bKindMapper.selectList(queryWrapper);
        return list;
    }

    public int insert(BKind kind) {
        int r = bKindMapper.insert(kind);
        return r;
    }

    public int update(BKind kind) {
        int r = bKindMapper.updateById(kind);
        return r;
    }

    public BKind selectById(Long id) {
        BKind kind = bKindMapper.selectById(id);
        return kind;
    }

    public int deleteById(Long id) {
        int r = bKindMapper.deleteById(id);
        return r;
    }
}
